﻿using UnityEngine;
using System.Collections;
using UnityEngine.Events;

namespace Lost{
	public class PasswordButton : LostButton {
		///buttonKey通过这个调用
		protected ButtonKey BtKey{
			get{ 
				if (buttonKey == null) {
					buttonKey = GetComponentInParent<ButtonKey> ();
				}
				return buttonKey;
			}
		}
		[SerializeField] ButtonKey buttonKey;
		[SerializeField] ButtonKey.ButtonFunction btFunc = ButtonKey.ButtonFunction.Add;
		[SerializeField] string BtValue = "";

		public override void Interact (HitInf hitInf)
		{
			base.Interact (hitInf);
			if (BtKey.OnButtonClicked (btFunc, BtValue)) {
				ItemsManager.iDestroy (this);
			}
		}
	}
}
